//    Copyright (C) Clear Office.  All rights reserved.
using System.Diagnostics;
using System.Diagnostics.Contracts;
using Office.Core;

namespace Office.Spreadsheet
{
    class RemoveCellUndoUnit: IUndoUnit
    {
        public RemoveCellUndoUnit(Cell cell)
        {
            Contract.Requires(cell != null);
            Debug.WriteLine("Creating RemoveCellUndoUnit " + cell + " " + cell.Address.Label);
            _cell = cell;
            _address = cell.Address;
        }

        readonly Cell _cell;
        readonly CellAddress _address;

        #region IUndoUnit Members

        public void Do()
        {
            Debug.WriteLine("Do " + this);
            _cell.Worksheet.AddCellAt(_cell, _address); //\\ problem here
        }

        public bool Merge(IUndoUnit unit)
        {
            return false;
        }

        #endregion
    }
}
